<?php
namespace app\service\controller;

use my\wechat\Message;

class Sms
{
    public function index()
    {
        echo "QY WeChat for Better Soft";
    }


    public function send()
    {
        $touser = base64_decode(input("touser"));
        $content = base64_decode(input("content"));

        if (empty($content)) return 'false';

        $touser = empty($touser) ? "@all" : $touser;

        Message::$touser = $touser;
        Message::$agentid = c('wx_sms_agentid');
        $ret = Message::send('text', $content);

        $suc = $ret ? "success" : Message::$error;
        return $suc;
    }
}